package com.buyaoa.apps.kis

class SimpleMenu {

	String name
    String description
    
    String tooltip
    String controllerId
    String actionUrl
        
    Integer sequence = 1
    
    /** enabled */
	boolean enabled = true
    
    SimpleMenu parent
    static belongsTo =[parent:SimpleMenu ]
    static hasMany = [childrens:SimpleMenu]
    static mapping = {   
       parent:[column:'parent_Id',lazy:"true",cascade:"none"]
       children joinTable:[name:'children', key:'parent_Id', column:'Id',lazy:"true",inverse:"false",cascade:"none"]   
       sort "sequence"
    }   
    static constraints = {
        name(nullable:false,empty:false,maxLength:50)
        description(maxLength:250,empty:false)
        parent(nullable:true)
        sequence(min:0)

        controllerId(nullable:true, empty:false, maxSize:32)
        actionUrl(nullable:true, empty:true, maxSize:250)
        
    }
    
    String toString() {
		"${this.name}"
    }
}
